<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript对象</title>
  </head>
  <body>
    <p>JavaScript对象是拥有属性和方法的数据。</p>

    <h3>对象定义</h3>
    <p>可以使用字符串定义和创建JavaScript对象。</p>
    <script type="text/javascript">
      var me={name:"Tiger",age:"23"};
      document.write("<p>我的名字是"+me.name+"，今年"+me["age"]+"岁</p>");
    </script>

    <h3>对象方法</h3>
    <script type="text/javascript">
      var me={
        name:"Smartown",
        age:"23",
        toString : function(){
          return "<p>我的名字是"+this.name+"，今年"+this["age"]+"岁</p>"
        }
      }
      document.write(me.toString());
    </script>
  </body>
</html>
